<script>
import initApp from '@/common/appInit.js';
import openApp from '@/common/openApp.js';
import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js';
export default {
	globalData: {
		searchText: '',
		appVersion: {},
		config: {},
		$i18n: {},
		$t: {}
	},
	onLaunch: function() {
		console.log('App Launch');

		this.globalData.$i18n = this.$i18n;
		this.globalData.$t = str => this.$t(str);
		this.globalData.tabbar = [
			{
				iconPath: '/static/tabbar/home.png',
				selectedIconPath: '/static/tabbar/home_active.png',
				text: '首页',
				pagePath: '/pages/home/home'
			},
			{
				iconPath: '/static/tabbar/attention.png',
				selectedIconPath: '/static/tabbar/attention_active.png',
				text: '学习',
				pagePath: '/pages/class/class'
			},
			// {
			// 	iconPath: '/static/tabbar/attention.png',
			// 	selectedIconPath: '/static/tabbar/attention_active.png',
			// 	text: '关注',
			// 	count: 2,
			// 	isDot: true,
			// 	pagePath: '/pages/list/list'
			// },
			// {
			// 	iconPath: '/static/tabbar/issue.png',
			// 	selectedIconPath: '/static/tabbar/issue_active.png',
			// 	text: '发布',
			// 	midButton: true,
			// 	pagePath: '/pages/grid/grid'
			// },
			// {
			// 	iconPath: '/static/tabbar/message.png',
			// 	selectedIconPath: '/static/tabbar/message_active.png',
			// 	text: '消息',
			// 	count: 2,
			// 	isDot: true,
			// 	pagePath: '/pages/grid/grid'
			// },
			{
				iconPath: '/static/tabbar/me.png',
				selectedIconPath: '/static/tabbar/me_active.png',
				text: '我的',
				pagePath: '/pages/ucenter/ucenter'
			}
		];
		initApp();

		// #ifdef H5
		openApp(); //创建在h5端全局悬浮引导用户下载app的功能
		// #endif
		// #ifdef APP-PLUS
		//checkIsAgree(); APP端暂时先用原生默认生成的。目前，自定义方式启动vue界面时，原生层已经请求了部分权限这并不符合国家的法规
		// #endif

		// #ifdef H5
		// checkIsAgree(); // 默认不开启。目前全球，仅欧盟国家有网页端同意隐私权限的需要。如果需要
		// #endif

		// #ifdef APP-PLUS
		//idfa有需要的用户在应用首次启动时自己获取存储到storage中
		//https://ask.dcloud.net.cn/article/36107
		/*if(~plus.storage.getItem('idfa')){
				plus.device.getInfo({//需要勾选IDFA
					success:function(e){  
						console.log('idfa =  '+JSON.stringify(e.idfa));  
					},
					fail:function(e){
						console.log('getDeviceInfo failed: '+JSON.stringify(e));  
					}  
				});
			}*/
		// #endif
	},
	onShow: function() {
		console.log('App Show');
	},
	onHide: function() {
		console.log('App Hide');
	}
};
</script>

<style lang="scss">
/*每个页面公共css */
@import 'uview-ui/index.scss';
</style>
